﻿#parse("partials/headerpopup.html")
<script type="text/javascript">
    $(document).ready(function () {
        ///Search Doctor
//        var oTable = $('#datalist').dataTable({
//            "bSort": false,
//            "sPaginationType": "full_numbers",
//            "bProcessing": false,
//            "bServerSide": true,
//            "bFilter": true,
//            "sAjaxSource": "tablelistdoctor",
//            "aoColumns": [
//                            { "mDataProp": "Id" },
//                            { "mDataProp": "DoctorCode" },
//                            { "mDataProp": "DoctorName" },
//                            { "mDataProp": "Specialist" },
//                        ],
//            "aoColumnDefs": [
//                                {
//                                    "fnRender": function (o) {
//                                        return "<center><a class='dok' title='Select Doctor' href='javascript:void(0)' doctorId='" + o.aData['Id'] + "' doctorName='" + o.aData['DoctorName'] + "' UserId='" + o.aData['UserId'] + "' ><img src='/images/Icons/table.png'/></a> </center>";

//                                    },
//                                    "aTargets": [0]
//                                }
//                        ],
//            "fnServerData": function (sSource, aoData, fnCallback) {
//                aoData.push({ "name": "doctorname", "value": $('#doctorname').val() });
//                aoData.push({ "name": "code", "value": $('#code').val() });
//                aoData.push({ "name": "TextBoxDoctorSpecialist", "value": $('#TextBoxDoctorSpecialist').val() });
//                jQuery.ajax({
//                    "dataType": 'json',
//                    "type": "GET",
//                    "url": "tablelistdoctor",
//                    "data": aoData,
//                    "success": fnCallback
//                });
//            }
//        });

//        function checkForEnter(event) {
//            if (event.keyCode == 13) {
//                oTable.fnDraw();
//            }
//        }

//        $('#doctorname').keypress(checkForEnter);
//        $('#code').keypress(checkForEnter);
//        $('#TextBoxDoctorSpecialist').keypress(checkForEnter);
//        $('#buttonSearch').click(function () { oTable.fnDraw(); });

//        //Add event click on list doctor
//        $(".dok").live('click', function (event) {
//            var doctorId = $(this).attr("doctorId");
//            var doctorName = $(this).attr("doctorName");
//            var UserId = $(this).attr("UserId");
//            parent.setReferedDoctorTextBox(doctorId, doctorName, UserId);
//        });

    });
    //End Document.ready
</script>
<!--<style>
    div#datalist_filter 
    {
        display:none;
    }
    div#datalist_length 
    {
        display:none;
    }
    .mws-table thead 
    {
        margin-top:-10px;
    }
</style>-->
<form method="post" action="#" class="crud" id="mws-validate">
<div class="mws-form" action="#">
    <div class="mws-form-inline">
        <div class="mws-form-row">
            <label>
                Booker Name</label>
            <div class="mws-form-item">
                <div class="mws-form-cols clearfix">
                    <div class="mws-form-col-8-8">
                        <div class="mws-form-item">
                            <input type="text" class="mws-textinput validate[required]" name="title" id="title"
                                maxlength="30" />
                            <input type="hidden" id="doctorid" value='' name="doctorid" />
                            <input type="hidden" id="startdate" value='' name="startdate" />
                            <input type="hidden" id="enddate" value='' name="enddate" />
                            <input type="hidden" id="idAp" value='' name="enddate" />
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="mws-form-row">
            <label>
                Telp</label>
            <div class="mws-form-item">
                <div class="mws-form-cols clearfix">
                    <div class="mws-form-col-8-8">
                        <div class="mws-form-item">
                            <input type="text" class="mws-textinput validate[required]" name="telp" id="telp"
                                maxlength="30" />
                           
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <br />
    <div class="mws-button-row">
        <input name="btnAction" class="mws-button red" type="submit" value="Save" id="btnAction" />
        <input name="btnDelete" class="mws-button red" type="submit" value="Delete" id="btnDelete" />
    </div>
</div>
</form>
#parse("partials/footerpopup.html")

<script type="text/javascript">

    $("#mws-validate").submit(
        function () {
            if ($("#mws-validate").valid() == true) {
                $.blockUI();
                var post_data = $(this).serialize();
                var form_action = $(this).attr("action");
                var form_method = $(this).attr("method");
                $.ajax({
                    type: form_method,
                    url: form_action,
                    cache: false,
                    dataType: "json",
                    data: post_data,
                    success: function (data) {
                        window.scrollTo(0, 0);
                        setTimeout(function SuccessHandler() {
                            $.unblockUI();
                            $("#notif").html(data['strNotification']);
                            $("#MedicalRecordNumber").val(data['mrn']);
                            $("#PatientId").val(data['patientId']);
                            //$("#buttonAction").attr("disabled", "disabled");
                            if (data['strNotification'] != null)
                                OpenPopupConfirm();

                        }, 2000);

                    },
                    error: function () {
                        alert("Error Occured on Post Ajax");
                        $.unblockUI();
                    },
                    complete: function () {

                    }
                });
            }
            return false;
        });




</script>
